package com.droidclaimsurveyor.dal;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;


public class CarImageDBHelper extends SQLiteOpenHelper {
	public static final String DATABASE_TABLE 		= "carimage";
	public static final String DATABASE_NAME 		= "droidclaim.db";
	public static final int DATABASE_VERSION 		= 2;

	public static final String KEY_ID 				= "id";
	public static final String KEY_CARIMAGE_ID 		= "carimageid";	
	public static final String KEY_IMAGE_PATH 		= "imgPath";
	public static final String KEY_CLAIM_ID 		= "claim_Id";

	private final String DATABASE_CREATE 		= "create table " + 
			DATABASE_TABLE + " (" + KEY_ID + " integer primary key autoincrement, " +
			KEY_CARIMAGE_ID + " integer, " +
			KEY_CLAIM_ID + " integer, " +
			KEY_IMAGE_PATH + " varchar(64) );";
	
	public CarImageDBHelper(Context context, String name,CursorFactory factory, int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
        db.execSQL(DATABASE_CREATE);	
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// drop table if exist
		db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
        // Create a new one.
        onCreate(db);
	}
}